{  ACMP.RU
   Statement: http://acmp.ru/?main=task&id_task=9
   Verdict: Accepted
}
uses 
    SysUtils, Math;
    
var 
    i,n,mn,mx,t,ans:longint;
    a:array[0..110] of longint;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
mn:=1;
mx:=1;
ans:=0;
for i:=1 to n do begin
    read(a[i]);
    if a[i]>0 then inc(ans,a[i]);
    if a[i]<a[mn] then mn:=i;
    if a[i]>a[mx] then mx:=i;
end;
write(ans,' ');
if mn>mx then begin
    t:=mn;
    mn:=mx;
    mx:=t;
end;
inc(mn);
dec(mx);
if mn>mx then ans:=0 else ans:=1;
for i:=mn to mx do
    ans:=ans*a[i];
write(ans);
end.